//
//  JWTabBarController.m
//  见闻新闻
//
//  Created by brother on 16/2/26.
//  Copyright © 2016年 JoanBoat. All rights reserved.
//

#import "JWTabBarController.h"
#import "JWSideView.h"
#import "JWMainViewController.h"
#import "JWLoginViewController.h"

@interface JWTabBarController ()

@property (nonatomic ,assign)BOOL isdraging;

@end

@implementation JWTabBarController


- (void)viewDidLoad {
    [super viewDidLoad];
    [self addNavControllerWithStoryBoarName:@"Home" withTitle:@"首页" withImageName:@"tabbar_home" withSelImageName:@"tabbar_home_selected"];
    [self addNavControllerWithStoryBoarName:@"Video" withTitle:@"资讯" withImageName:@"tabbar_message_center" withSelImageName:@"tabbar_message_center_selected"];
    [self addNavControllerWithStoryBoarName:@"Find" withTitle:@"发现" withImageName:@"tabbar_discover" withSelImageName:@"tabbar_discover_selected"];
    [self addNavControllerWithStoryBoarName:@"Specific" withTitle:@"个性" withImageName:@"tabbar_profile" withSelImageName:@"tabbar_profile_selected"];
    
  
}






-(void)addNavControllerWithStoryBoarName:(NSString *)name withTitle:(NSString *)title withImageName:(NSString *)imageName withSelImageName:(NSString *)selImageName {
    UIStoryboard *StoryBoard = [UIStoryboard storyboardWithName:name bundle:nil];
    UINavigationController *nav = [StoryBoard instantiateInitialViewController];
    
    NSDictionary *dic = @{NSForegroundColorAttributeName:[UIColor orangeColor]};
    [nav.tabBarItem setTitleTextAttributes:dic forState:UIControlStateSelected];
    UIViewController *vc= nav.viewControllers[0];
    vc.title = title;
    nav.tabBarItem.image = [UIImage imageNamed:imageName];
    UIImage *selImage = [[UIImage imageNamed:selImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    nav.tabBarItem.selectedImage = selImage;
    [self addChildViewController:nav];
}




@end
